package com.practice.bootdemo.cond;

import com.practice.bootdemo.service.impl.LinuxServiceImpl;
import com.practice.bootdemo.service.impl.WindowsServiceImpl;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

/**
 * @author :Administrator
 * @description: TODO edit class Description
 * @create date: 2022/12/5 22:54
 */
@Configuration
public class SystemNameCondConfig {

    @Conditional(WindowsCondition.class)    // 符合windows条件后就会实例化WindowsServiceImpl
    public WindowsServiceImpl getWindows(){
        return new WindowsServiceImpl();
    }

    @Conditional(LinuxCondition.class)  // 符合Linux条件后就会实例化 LinuxServiceImpl
    public LinuxServiceImpl getLinux(){
        return new LinuxServiceImpl();
    }
}
